<#include "/WEB-INF/default/fragment/header.ftl">
<body>

<#include "/WEB-INF/default/fragment/nav.ftl">

<style>
.workspace-stats {
  width: 100%;
  margin-bottom: 20px;
  border: 1px solid #eee;
  box-sizing: border-box;
}
.workspace-stats a {
  color: #fff;
}
.workspace-stats.current {
  border: 1px solid #999;
}
.workspace-stats h4 {
  background-color: #eee;
  padding: 5px;
  text-align: center;
  margin: 0px;
  font-weight: 100;
}
.workspace-stats.current > h4 {
  background-color: #d00e31;
  color: #fff;
}
.workspace-stats ul,
.workspace-stats li {
  list-style: none;
  margin: 0px;
  padding: 0px;
}
.workspace-stats li {
  float: left;
  width: 14.285714285714%;
  text-align: center;
}
.workspace-stats > ul.weeks {
  height: 44px;
  line-height: 44px;
  border-bottom: 1px solid #999;
  box-sizing: content-box;
}
.workspace-stats .days li {
  height: 106px;
  border-bottom: 1px solid #999;
}

.workspace-stats > ul.calendar {
}

.workspace-stats > ul.calendar > li {
  position: relative;
}
.workspace-stats .days li.enable:hover {
  background-color: #eee;
}

.workspace-stats > ul.calendar > li > div.day {
  width: 16px;
  height: 16px;
  line-height: 16px;
  position: absolute;
  top: 0px;
  left: 2px;
  font-size: 12px;
  background: #eee;
  border-radius: 2px;
}
.workspace-stats > ul.calendar > li.passed-days {
  background-color: #eee;
}

.workspace-stats > ul.calendar > li.today > div.day {
  background-color: #d00e31;
  color: #fff;
}

.workspace-stats > ul.calendar > li > div.tips {
  position: absolute;
  margin: 0px 2px;
  font-size: 12px;
  text-align: left;
  padding: 0px 2px;
  border-radius: 2px;
  height: 15px;
  overflow: auto;
}
.workspace-stats > ul.calendar > li > div.tips.no-homework {
  bottom: 2px;
  background: rgb(39, 40, 34);
  color: #fff;
  height: 31px;
  overflow: auto;
}

.workspace-stats > ul.calendar > li > div.tips.stage-practice {
  bottom: 52px;
  background: #6B9E00;
  color: #fff;
}
.workspace-stats > ul.calendar > li > div.tips.exception {
  bottom: 35px;
  background: red;
  color: #fff;
}
.workspace-stats > ul.calendar > li > div.tips.task {
  bottom: 69px;
  background: #d00e31;
  color: #fff!important;
}
.workspace-stats > ul.calendar > li > div.op {
  position: absolute;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  width: 100%;
  font-size: 12px;
  overflow: hidden;
  height: 0;
  transition: all 0.2s linear;
}
.workspace-stats > ul.calendar > li > div.op.show {
  height: 28px;
  line-height: 28px;
  background: rgba(0,0,0,1);
}

.workspace-stats-desc {
  margin: 5px 0px;
}

.workspace-stats-desc div {
  font-size: 12px;
  padding: 0px 2px;
  border-radius: 2px;
  margin-top: 2px;
}
.workspace-stats-desc .homework-not-submit {
  background: rgb(39, 40, 34);
  color: #fff;
}

.workspace-stats-desc .stage-practice {
  background: #6B9E00;
  color: #fff;
}
.workspace-stats-desc .exception {
  background: red;
  color: #fff;
}
.workspace-stats-desc .task {
  background-color: #d00e31;
  color: #fff;
}

.tech-item {
}

</style>

<script>
var beginDate = new Date(${(teamList.gmtBegin*1000)?c});
var endDate = new Date(${(teamList.gmtEnd*1000)?c});
var allMembers = ['蔡颖', '陈妥', '龚鹏辉', '郭雄相', '金祥', '李晨阳', '李通', '皮亚东', '唐美华', '肖喆鑫', '杨青江', '杨易', '易著友', '张思娜', '盘军发']; // 团队成员。'谢兴浩'已离队
var task = ${tasks!"[]"};
var studentsData  = {
    2016: {
        11: {
            'task': {
                21: [
                    '开班'
                ]
            }
        },
        12: {
            'task': {
                26: [
                    '<a href="./MySQL/12.%20%E8%81%9A%E9%9B%86%E5%87%BD%E6%95%B0.txt">聚合函数</a>'
                ],
                27: [
                    '<a href="./MySQL/13.%20%E5%88%86%E7%BB%84%E6%95%B0%E6%8D%AE.txt">分组查询</a>'
                ],
                28: [
                    '<a href="./MySQL/14.%20%E5%AD%90%E6%9F%A5%E8%AF%A2.txt">子查询</a>'
                ],
                30: [
                    '<a href="./MySQL/16.%20%E5%88%9B%E5%BB%BA%E9%AB%98%E7%BA%A7%E8%BF%9E%E6%8E%A5.txt">高级链接，综合运用</a>'
                ]
            },
            'stagePractice': {
                23: ['Quickhit 小游戏'],
                30: ['Quickhit 小游戏提交截止日期']
            },
            'studentOfException': {
                26: ['龚鹏辉', '张思娜去学校'],
                28: ['[迟]龚鹏辉'],
                29: ['[迟]谢兴浩'],
                30: ['杨清江', '[旷]龚鹏辉'] // 下午不见人
            },
            'studentOfNotSumitHomework' : {
                27: ['张思娜', '李晨阳', '龚鹏辉', '皮亚东', '肖喆鑫'],
                28: ['李晨阳', '杨清江', '肖喆鑫（有问题）']
            }
        }
    },
    2017: {
        1: {
            'task': {
                3: [
                    '<a href="./MySQL/18.%20%E5%85%A8%E6%96%87%E6%90%9C%E7%B4%A2.txt">全文搜索</a>',
                    '<a href="./MySQL/19.%20%E6%8F%92%E5%85%A5%E6%95%B0%E6%8D%AE.txt">insert select</a>',
                    '加强查询练习准备周五结业考'
                ],
                4: [
                    '<a href="./MySQL/21.%20创建表.txt">操作表</a>',
                    '<a href=".###">视图</a>',
                    '<a href="./MySQL/23.%20%E5%82%A8%E5%AD%98%E8%BF%87%E7%A8%8B.txt">存储过程</a>'
                ],
                5: [
                    '<a href="./MySQL/23.%20%E5%82%A8%E5%AD%98%E8%BF%87%E7%A8%8B.txt">存储过程+游标</a>',
                    '<a href="###">锁和事务</a>',
                    '<a href="###">安全</a>'
                ],
                6: [
                    '<a href="###">索引</a>',
                    '<a href="###">字符集</a>',
                    '<a href="###">数据库安全</a>'
                ],
                9: [
                    '<a href="./MySQL/28. 安全管理.txt">数据库管理</a>',
                    '<a href="./MySQL/29. 虚拟环境安装 MySQL.txt">虚拟环境安装 MySQL</a>'
                ],
                10: [
                    '<a href="./JavaOOP/08. JDBC.txt">JDBC</a>'
                ],
                11: [
                    '<a href="./JavaOOP/">JDBC + DAO</a>'
                ],
                12: [
                    '<a href="./JavaOOP/">DAO</a>'
                ],
                16: ['装机', '设置内部服务器'],
                17: ['装机', '转移教学管理系统至 55 上'],
                18: ['装机', '上线完毕，准备培训使用', '内训']
            },
            'stagePractice': {
                6: ['<a href="./MySQL/mysql%20%E6%B5%8B%E8%AF%95%E9%A2%98.txt">MySQL 结业</a>'],
                9: ['<a href="./MySQL/mysql%20%E6%B5%8B%E8%AF%95%E9%A2%98.txt">MySQL 结业成绩提交结束</a>'],
                10: ['<a href="./JavaOOP/08. JDBC.txt">JDBCDriverManager 和四个接口的使用</a>'],
                11: ['<a href="./JavaOOP/09. 数据访问层（DAO）.txt">DAO模式和JDBC 封装</a>'],
                12: ['<a href="./JavaOOP/09. 数据访问层（DAO）.txt">宠物商店第一部分（作业2）</a>'],
                18: ['<a href="./行政日常/2016 年终培训 ppt + 试题 + 答案.zip">内训</a>'],
                22: ['<a href="./行政日常/2016 年终培训 ppt + 试题 + 答案.zip">JDBC阶段练习</a>']

            },
            'studentOfException': {
                4: [
                    '[假]杨青江'
                ],
                5: [
                    '[假]张思娜',
                    '[旷]龚鹏辉'
                ],
                6: [
                    '[旷]龚鹏辉'
                ],
                10: [
                    '[假]张思娜',
                    '[假]谢兴浩',
                    '[假]皮亚东'
                ],
                11: [
                    '[假]张思娜'
                ],
                12: [
                    '[假]张思娜'
                ]
            },
            'studentOfNotSumitHomework' : {
                3: ['龚鹏辉', '李晨阳', '肖喆鑫', '杨青江'],
                4: ['龚鹏辉', '皮亚东', '肖喆鑫', '谢兴浩', '杨青江'],
                5: ['蔡颖', '陈妥', '龚鹏辉', '李晨阳', '皮亚东', '肖喆鑫', '谢兴浩', '杨青江', '张思娜'],
                6: ['龚鹏辉'],
                9: ['龚鹏辉', '陈妥', '皮亚东', '肖喆鑫', '谢兴浩', '杨青江', '易著友', '张思娜'],
                10: ['只交 DAO 章节的作业即可'],
                11: ['陈妥', '龚鹏辉', '李晨阳', '李通', '皮亚东', '唐美华', '肖喆鑫', '杨青江', '易著友', '张思娜']
            }

        },
        2: {
            'task': {
                6: ['<a href="">多线程</a>', '<a href="./HTML+CSS/01. HTML基础.pptx">HTML基础</a>'],
                7: ['<a href="./HTML+CSS/02. 列表、表格、框架.pptx">列表、表格、框架</a>', '<a href="./HTML+CSS/03. 表单.txt">课堂笔记</a>'],
                8: ['<a href="./HTML+CSS/03. 表单.txt">表单</a>', '<a href="./HTML+CSS/04. 初识css.pptx">初识css</a>', '<a href="./HTML+CSS/04. 初识css.txt">课堂笔记</a>'],
                9: ['<a href="./HTML+CSS/05. CSS 美化网页元素.pptx">CSS 美化网页元素</a>', '<a href="./HTML+CSS/05. CSS 美化网页元素.txt">课堂笔记</a>'],
                10: ['<a href="./HTML+CSS/06. 盒子模型.pptx">盒子模型</a>', '<a href="./HTML+CSS/06. 盒子模型.txt">课堂笔记</a>'],
                13: ['<a href="./HTML+CSS/07. 浮动.pptx">浮动</a>', '<a href="./HTML+CSS/07. 浮动.txt">课堂笔记</a>','<a href="07. 定位.pptx">定位</a>'],
                14: ['<a href="./JavaScript/01. JavaScript基础.pptx">浮动</a>', '<a href="./JavaScript/01. JavaScript基础.txt">课堂笔记</a>','<a href="07. 定位.pptx">定位</a>'],
                15: ['JavaScript基础', 'JavaScript的对象'],
                16: ['初始jQuery', 'jQuery选择器', 'jQuery事件'],
                17: ['jQuery操作 dom 节点', 'jQuery 综合练习'],
                20: ['jQuery综合练习'],
                21: ['<a href="./JSP+Servlet/01. 动态网页开发基础.pptx">JSP</a>', '<a href="./JSP+Servlet/01. 动态网页开发基础.txt">课堂笔记</a>'],
                22: ['jsp简介', 'jsp数据交互一（out, request, response, session）'],
                23: ['jsp数据交互二（application）'],
                24: ['JSP + JDBC'],
                27: ['JSP + JDBC', '码农社区登录和注册'],
                28: ['JSP + JDBC', '码农社区发帖，看帖']
            },
            'stagePractice': {
                4: ['宠物商店练习'],
                5: ['宠物商店练习'],
                10: ['JDBC阶段练习提交截止日期'],
                14: ['<a href="./HTML+CSS/09. 课程总复习.txt">开心网游戏页</a>']
            },
            'studentOfException': {
                4: ['[假]唐美华', '[假]杨清江', '[假]龚鹏辉', '[假]易著友'],
                5: ['[假]张思娜', '[假]杨清江', '[假]龚鹏辉', '[假]易著友'],
                6: ['[假]张思娜', '[假]杨清江', '[假]易著友'],
                7: ['[假]张思娜', '[假]杨清江', '[迟]皮亚东', '[迟]龚鹏辉'],
                8: ['[假]张思娜', '[假]杨清江', '[假]杨易', '[迟]李晨阳'],
                9: ['[假]张思娜', '[假]杨清江', '[假]杨易', '[迟]李晨阳', '[迟]皮亚东', '[迟]李通'],
                10: ['[假]张思娜', '[假]杨清江', '[假]龚鹏辉'],
                13: ['[假]张思娜', '[假]杨清江'],
                14: ['[假]张思娜', '[假]杨清江'],
                15: ['[假]张思娜', '[假]杨清江'],
                16: ['[假]张思娜', '[假]杨清江', '[假]皮亚东'],
                17: ['[假]张思娜', '[假]杨清江', '[假]皮亚东'],
                20: ['[假]张思娜', '[假]杨清江'],
                21: ['[假]张思娜', '[假]杨清江', '[旷]龚鹏辉'],
                22: ['[假]张思娜', '[假]杨清江', '[旷]龚鹏辉'],
                23: ['[假]张思娜', '[旷]龚鹏辉'],
                23: ['[假]张思娜', '[旷]龚鹏辉', '李通', '李晨阳']
            },
            'studentOfNotSumitHomework' : {
                // 9: ['蔡颖', '陈妥', '龚鹏辉', '郭雄相', '金祥', '李晨阳', '李通', '皮亚东', '唐美华', '肖喆鑫', '谢兴浩', '杨青江', '杨易', '易著友', '张思娜'],
                6: ['李通', '皮亚东', '杨青江', '杨易', '易著友', '张思娜'],
                7: ['蔡颖', '陈妥', '龚鹏辉', '李晨阳', '李通', '皮亚东', '肖喆鑫', '谢兴浩', '杨青江', '杨易', '易著友', '张思娜'],
                8: ['陈妥', '龚鹏辉', '皮亚东', '杨青江', '杨易', '易著友', '张思娜'],
                9: ['蔡颖', '陈妥', '龚鹏辉', '李通', '皮亚东', '杨青江', '杨易', '张思娜'],
                10: ['陈妥', '龚鹏辉', '李晨阳', '李通', '皮亚东', '肖喆鑫', '谢兴浩', '杨青江', '杨易', '易著友', '张思娜'],
                13: ['陈妥', '龚鹏辉', '郭雄相', '李晨阳', '皮亚东', '肖喆鑫', '谢兴浩', '杨青江', '杨易', '张思娜'],
                14: ['蔡颖', '龚鹏辉', '郭雄相', '李晨阳', '皮亚东', '唐美华', '肖喆鑫', '谢兴浩', '杨青江', '杨易', '易著友', '张思娜'],
            }
        },
        3: {
            'task': {
                1: ['文件上传', 'servlet'],
                2: ['Servlet 参数', 'Servlet 上下文'],
                3: ['XML + 反射'],
                6: ['使用 mvn 进行 hibernate 环境搭建'],
                7: ['<a href="./Hibernate/04.%20Hibernate入门.txt">hibernate 基本概念和单表 CRUD</a>'],
                8: ['HQL + 连接'],
                9: ['Hibernate 关联映射'],
                10: ['Hibernate 如何使用原生 sql和命名查询'],
                13: ['Hibernate 一级缓存'],
                14: ['Hibernate 综合练习+BBSDAO层改造'],
                15: ['Hibernate 综合练习+BBSDAO层改造'],
                16: ['Struts2 + 实现的 MVC 小框架'],
                17: ['<a href="./Struts2/02. Struts 2初体验.txt">Struts2 简介，配置第一部分</a>'],
                20: ['Struts2 简介，配置第二部分'],
                21: ['<a href="./Struts2/03. Struts 2配置详解.txt">Struts2 strtus.xml 配置深入讲解</a>'],
                22: ['<a href="./Struts2/04. Struts 2深入.txt">Struts2 拦截器和文件上传</a>'],
                23: ['<a href="./Struts2/04. Struts 2深入.txt">课堂联系，拦截器的认知</a>'],
                24: ['<a href="./Struts2/04. Struts 2深入.txt">Hibernate 拦截器的使用</a>'],
                27: ['<a href="./Struts2/04. Struts 2深入.txt">拦截器课堂联系</a>'],
                28: ['<a href="./Struts2/04. Struts 2深入.txt">文件上传深入，写入数据库的上传和下载</a>'],
                29: ['<a href="./Struts2/05. OGNL.txt">05. OGNL.txt</a>'],
                30: ['<a href="./Struts2/05. OGNL.txt">05. OGNL.txt</a>'],
                31: ['<a href="./Struts2/06. Struts 2数据校验.txt">自动化验证</a>']
            },
            'stagePractice': {
                13: ['Hibernate BBS DAO 层改造'],
                20: ['TMS 立项'],
                21: ['登录注册整合进 TMS'],
                24: ['hibernate拦截器整合进 TMS'],
                28: ['文件上传下载整合进 TMS'],
            },
            'studentOfException': {
                1: ['[假]李晨阳', '[假]张思娜', '[假]龚鹏辉'],
                2: ['[假]李晨阳', '[假]张思娜', '[假]龚鹏辉'],
                3: ['[假]李晨阳', '[假]张思娜', '[假]龚鹏辉'],
                6: ['[假]李晨阳', '[假]龚鹏辉'],
                7: ['[假]李晨阳', '[假]张思娜', '[假]龚鹏辉'],
                8: ['[假]李晨阳', '[假]张思娜', '[假]龚鹏辉'],
                9: ['[假]张思娜', '[假]龚鹏辉'],
                10: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳'],
                13: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳'],
                14: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳'],
                15: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳'],
                16: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳'],
                16: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳', '[假]杨青江（下午）', '[假]杨易'],
                17: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳'],
                20: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳', '[假]杨青江'],
                21: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳', '[假]杨青江'],
                22: ['[假]张思娜', '[假]龚鹏辉', '[假]李晨阳', '[假]杨青江']
            },
            'studentOfNotSumitHomework': {
                1: []
            }
        },
        4: {
            'task': {
                5: ['复习JavaScript+jQuery', 'Ajax 概念认知和服务端交互练习'],
                6: ['json 概念认知', 'json + ajax'],
                7: ['Ajax + Struts2 Validation'],
                10: ['Spring 概念和基础配置'],
                11: ['IOC + DI'],
                12: ['Spring + JDBC, Spring + Hibernate'],
                13: ['Spring + AOP, Spring Transaction'],
                14: ['综合练习 整合 ssh 框架'],
                17: ['项目实训'],
                18: ['git 在 eclipse 中的使用', '学会使用版本管理工具进行团队协作']
            },
            'stagePractice': {
                14: ['ssh 框架到　ＴＭＳ　项目中']
            },
            'studentOfException': {

            },
            'studentOfNotSumitHomework' : {

            }

        }

    }
};

</script>

<div class="container">
  <div class="tms-logo"><img class="center-block" src="${request.contextPath}/assets/images/logo.png" alt=""></div>
</div>

<div class="container">
  <div class="tech-item-header">
    <div class="clearfix">
      <h4 class="fl"><a href="${request.contextPath}/my_team?team.id=${teamList.id}">${teamList.name}</a></h4>
      <h4 class="fr">今天是<span id="today">${today?string("yyyy年MM月dd日")}，教学完成度91.58%</span></h4>
    </div>
    <div id="study_process" style="height: 2px; background-color: #999; width: 100%;margin-top: 10px;">
      <div id="finished_process" style="height: 2px; background-color: rgb(208, 15, 50); width: 0; transition: all 2s linear;"></div>
    </div>
    <script type="text/javascript">
    </script>
  </div>
</div>

<style>
  .row {
    margin: 10px 0 10px 0;
  }
  .row.title {
    border-bottom: 1px solid #eee;
  }
  .row.body {
  }

  .row.body > ul {
    margin: 0;
    padding: 0;
  }
  .row.body > ul > li {
    list-style: none;
    margin-right: 10px;
  }
</style>
<div class="container">
  <div class="row title clearfix">
    <div class="pull-left"><h5>项目管理</h5></div>
    <div class="pull-right"><a class="btn btn-link" href="${request.contextPath}/project?project.team.id=${teamList.id}">添加项目</a></div>
  </div>
  <div class="row body clearfix">
    <ul>
    <#if projectList??>
      <#list projectList as m>
      <li class="pull-left"><a href="###">${m.title}</a></li>
      </#list>
      </#if>
    </ul>
  </div>
</div>

<div class="container">
  <div class="row title clearfix">
    <div class="pull-left"><h5>团队成员</h5></div>
    <div class="pull-right"><a class="btn btn-link" href="${request.contextPath}/team_invite?team.id=${teamList.id}">邀请成员</a></div>
  </div>
  <div class="row body clearfix">
    <ul>
    <#if userList??>
      <#list userList as m>
      <li class="pull-left"><a href="###">${m.nickname}</a></li>
      </#list>
      </#if>
    </ul>
  </div>
</div>

<div class="container">
  <div class="row title clearfix">
    <div class="pull-left"><h5>任务列表（top 20）</h5></div>
    <div class="pull-right"><a class="btn btn-link" href="${request.contextPath}/team_invite?team.id=${teamList.id}">所有任务</a></div>
  </div>
  <div class="row body clearfix">
    <ul>
    <#if taskList??>
      <#list taskList as m>
      <li><a href="###">${m.title}</a></li>
      </#list>
      </#if>
    </ul>
  </div>
</div>


<div class="container tech-item">
  <div class="workspace-stats-container">
    <!-- 按月份显示日历 -->
  </div>
  <div class="workspace-stats-desc">
    <div class="homework-not-submit">作业未提交</div>
    <div class="stage-practice">阶段练习，在页面中的阶段练习部分会有打分和参与情况统计</div>
    <div class="exception">异常学员，迟到或早退或旷课且未事先知会项目经理或者教学经理，以打卡机记录为准。</div>
    <div class="task">课程安排，任务记录等。</div>
  </div>

  <script id="workspace_stats_html" type="text/html">
    <div id="workspace_stats_{{month}}" class="workspace-stats" data-month="{{month}}">
      <h4 class=""><!--月份显示处--></h4>
      <ul class="weeks clearfix">
        <li>星期一</li>
        <li>星期二</li>
        <li>星期三</li>
        <li>星期四</li>
        <li>星期五</li>
        <li>星期六</li>
        <li>星期日</li>
      </ul>
      <ul class="calendar days clearfix"><!--日历显示处--></ul>
    </div>
  </script>

</div>

</div>

<script>
(function(currentYear, currentMonth, today) {
    if (typeof studentsData  == 'undefined') {
        alert('请注意，学生数据格式不正确');
        return;
    }
    if (typeof beginDate  == 'undefined'
        || typeof endDate  == 'undefined') {
        alert('请注意，实训期间数据格式不正确');
        return;
    }

    // 渲染所有成员
    (function(allMembers) {
        var $allMembersBox = $('.allMembers');
        $allMembersBox.append('<a href="./Members">查看所有(' + allMembers.length + ')：</a>&nbsp;');
        allMembers.forEach(function(val, index) {
            $allMembersBox.append('<a href="./Members/'+val+'/">'+val+'</a>&nbsp;&nbsp;');
        });
    })(allMembers);

    // 渲染教学进度
    (function(allProcess) {
        var today = new Date();
        beginDate = new Date(beginDate.getFullYear(), beginDate.getMonth() - 1, beginDate.getDate());
        var finished = today.getTime() - beginDate.getTime();
        var days = (finished/1000/(24 * 60 * 60));
        var per = (days/allProcess * 100).toFixed(2);
        per = (per <= 100)? per: 100;
        document.getElementById('finished_process').style.width = per + '%';
        document.getElementById('today').innerHTML = (today.getFullYear() + '年' + (today.getMonth() + 1) + '月' + today.getDate() + '日') + ('，教学完成度' + per + '%');
    })( (function() {
        return (((new Date(endDate.getFullYear(), endDate.getMonth() - 1, endDate.getDate())).getTime() - (new Date(beginDate.getFullYear(), beginDate.getMonth() - 1, beginDate.getDate())).getTime())/1000) / (24 * 60 * 60);
    })() );


    // 渲染日历
    var $container = $('.workspace-stats-container');
    for (var year in studentsData) {
        for (var month in studentsData[year]) {
            var html = $('#workspace_stats_html').html();
            html = html.replace(/\{{month}}/gi, month);
            $container.append(html);
            $(('#workspace_stats_' + month) + ' > h4').html(year + '年' + (month) + '月');

            var monthData = studentsData[year][month];
            var stagePractice = (monthData)? monthData['stagePractice']: {};
            var studentOfNotSumitHomework = (monthData)? monthData['studentOfNotSumitHomework']: {};
            var studentOfException = (monthData)? monthData['studentOfException']: {};
            var task = (monthData)? monthData['task']: {};

            var d = new Date();
            var beginDay = (new Date(d.getFullYear(), month-1, 0).getDay()); // 这个月 1 号是星期几
            var curMonthDays = new Date(d.getFullYear(), month, 0).getDate(); // 本月天数
            var $box = $(('#workspace_stats_' + month) + ' > ul.calendar');
            $box.hide();
            for (var i = 0, j = 0; i < (curMonthDays + beginDay); i++) {
                if (i < beginDay) {
                    $box.append('<li>&nbsp;</li>');
                    continue;
                }
                ++j;

                var content = '<div class="day"> ' + j + '</div>';
                if (typeof(studentOfNotSumitHomework) == 'undefined'
                    || typeof(studentOfNotSumitHomework[j]) == 'undefined'
                    || studentOfNotSumitHomework[j].length == 0) {
                } else {
                    content += '<div class="tips no-homework" title="未按时间提交作业或者作业不符合规则">' + studentOfNotSumitHomework[j].join(', ') + '</div>';
                }

                if (typeof(stagePractice) == 'undefined'
                    || typeof(stagePractice[j]) == 'undefined'
                    || stagePractice[j].length == 0) {
                } else {
                    content += '<div class="tips stage-practice" title="阶段练习或者考试">' + stagePractice[j].join(', ') + '</div>';
                }

                if (typeof(studentOfException) == 'undefined'
                    || typeof(studentOfException[j]) == 'undefined'
                    || studentOfException[j].length == 0) {
                } else {
                    content += '<div class="tips exception" title="异常学员">' + studentOfException[j].join(', ') + '</div>';
                }
                if (typeof(task) == 'undefined'
                    || typeof(task[j]) == 'undefined'
                    || task[j].length == 0) {
                } else {
                    content += '<div class="tips task" title="作业和任务">' + task[j].join(', ') + '</div>';
                }

                content += '<div class="op"><a class="j_task" href="###" data-date="' + (year + '-' + month + '-' + j) +'" data-team-id="${teamList.id}">任务</a>&nbsp;<a class="j_attendance" href="###" data-team-id="${teamList.id}">考勤</a></div>'

                var clazz = '';
                if (month == (currentMonth + 1) ) {
                    if (j == today) {
                        clazz = 'today';
                    } else if (j < today) {
                        clazz = 'passed-days';
                    }
                } else {
                    clazz = 'passed-days';
                }
                $box.append('<li class="enable ' + clazz + '">' + content + '</li>');
            }
        }
    }

    $(document).on('click', '.workspace-stats h4', function() {
        $(this).siblings('ul.calendar').toggle();
    });
    $(('#workspace_stats_' + (currentMonth + 1))).addClass('current');
    $(('#workspace_stats_' + (currentMonth + 1)) + ' > h4').click();
})((new Date()).getFullYear(),(new Date()).getMonth(), (new Date()).getDate());

$(document).on('mouseover', '.workspace-stats > ul.calendar > li', function() {
  $(this).find('.op').addClass('show');
});
$(document).on('mouseleave', '.workspace-stats > ul.calendar > li', function() {
  $(this).find('.op').removeClass('show');
});
$(document).on('click', '.j_task', function() {
  var teamId = $(this).attr('data-team-id');
  var date = $(this).attr('data-date');
  window.location.href = '${request.contextPath}/form?team.id=${teamList.id}&date='+date;
  return false;
});

</script>

</body>
<#include "/WEB-INF/default/fragment/footer.ftl">
